<template>
    <base-dialog v-bind="$attrs" v-on="$listeners" :title="title" width="600px" @submit="toAdd" :is-view="disabled">
        <el-form ref="elForm" label-width="auto" :model="formData" :rules="rules" :disabled="disabled">
            <el-form-item label="收件人" prop="alias">
                <el-input v-model="formData.alias" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="消息标题" prop="title">
                <el-input v-model="formData.title"></el-input>
            </el-form-item>
            <el-form-item label="消息内容" prop="desc">
              <my-editor
                ref='editor'
                v-model="formData.desc"
                :disabled="disabled"
              ></my-editor>
            </el-form-item>
            <el-form-item label="上传附件" prop="files">
                <my-upload-file v-model="formData.files" previewOrDownload="download" :disabled="disabled"></my-upload-file>
            </el-form-item>
        </el-form>
    </base-dialog>
</template>
<script>
    import DetailDialog from "@/mixins/DetailDialog";
    import BaseDialog from "@/components/Common/BaseDialog";
    import MyUploadFile from "../../components/Common/MyUploadFile";
    import MyEditor from "../../components/editor/MyEditor";
    export default {
        name: "MsgDetailDialog",
        components: {MyEditor, MyUploadFile, BaseDialog},
        mixins: [DetailDialog],
        data() {
            return {
                formData: {
                    title: "",
                    desc: "",
                    files: null,
                    alias:undefined,
                    user:[],
                    type:undefined
                },
                rules: {
                    title: [{ required: true, message: "请输入标题", trigger: "blur" }],
                },
                apiUrl:"userSettings/msg"
            }
        },
        computed: {
            title() {
                return this.disabled?'查看消息':this.formData.id?"编辑消息":"新增消息"
            },
        },
        created() {
        },
        methods: {
        }
    }
</script>
